package com.wpr.shop.configure;

import com.wpr.shop.configure.interceptor.HttpRequestInterceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置拦截器
 * @Author wanggaofeng
 * @Date 2018/8/15 16:50
 */
@Configuration
public class WebConfituration implements WebMvcConfigurer {

    @Autowired
    private HttpRequestInterceptor requestInterceptor;

    /**
     * 将拦截器具体逻辑添加到连接器中
     * @Author wanggaofeng
     * @Date 2018/8/15 17:11
     **/
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(requestInterceptor).addPathPatterns("/**");
    }
}
